package com.ideabove.heart.data;


import com.ideabove.heart.util.LogUtil;

import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Rect;
import android.view.MotionEvent;

public class BitmapObj {
	private Bitmap src;
	private Rect touchRect;
	private int x;
	private int y;		
	
	public BitmapObj(Bitmap src, int x, int y, Rect touchRect){
		this.src = src;		
		this.x = x;
		this.y = y;
		this.touchRect = touchRect;
	}
	
	public void draw(Canvas canvas){
		
		if(src != null && !src.isRecycled()){
			canvas.drawBitmap(src, x,y, null);
		}		
	}
	
	public boolean isBoundary(MotionEvent event){
		if(touchRect == null){
			return false;
		}
		
		float x = event.getX();
		float y = event.getY();		
		
		return touchRect.contains((int)x, (int)y);		
	}
	
}
